modal convenience functions
All the modal convenience functions are appropriate for simple utilities, personal
programs, and in-house applications. Only XuiGetReply() is supports the built-in
InstantHelp, however, so XuiGetReply() is the only modal convenience function commercial
applications call.
custom convenience functions
You can easily make your own one-liner modal convenience functions. Just create a function
with whatever arguments are necessary to configure your window. When your program calls
it, it can :
create and configure a window based on the arguments
have XuiGetReply() display, operate, hide the modal window
extract information from the grid if necessary
setup return values or perform some action
The following example is a custom convenience function designed to display an XuiFile
grid/window and input a filename from the user.
' ####################
' ##### PROLOG ##### create and test sample modal convenience function GetFilename
' ####################
'
PROGRAM "getfile"
VERSION "0.0000"
'
IMPORT "xst"
IMPORT "xgr"
IMPORT "xui"
'
DECLARE FUNCTION Entry ()
DECLARE FUNCTION GetFilename (@filename$, @attributes)
'
' ######################
' ##### Entry () ##### test GetFilename() - a sample modal convenience function
' ######################
'
FUNCTION Entry ()
'
DO
a$ = ""
GetFilename (@file$, @attributes)
IFZ file$ THEN READ
"***** Cancel *****" : EXIT DO
'
SELECT CASE ALL TRUE
CASE (attributes AND $$FileReadOnly) : a$ = a$ + "FileReadOnly "
CASE (attributes AND $$FileHidden) : a$ = a$ + "FileHidden "
CASE (attributes AND $$FileSystem) : a$ = a$ + "FileSystem "
CASE (attributes AND $$FileDirectory) : a$ = a$ + "FileDirectory "
CASE (attributes AND $$FileArchive) : a$ = a$ + "FileArchive "
CASE (attributes AND $$FileNormal) : a$ = a$ + "FileNormal "
CASE (attributes AND $$FileTemporary) : a$ = a$ + "FileTemporary "
CASE (attributes AND $$FileAtomicWrite) : a$ = a$ + "FileAtomicWrite "
CASE (attributes AND $$FileExecutable) : a$ = a$ + "FileExecutable "
END SELECT
'
IFZ a$ THEN a$ = "FileNonexistent"
READ "\""; file$; "\" :
"; HEX$ (attributes,8); " = "; a$
LOOP
END FUNCTION
'
' ############################
' ##### GetFilename () ##### sample convenience function to input full filename$
' ############################
'
FUNCTION GetFilename (filename$, attributes)
filename$ = ""
attributes = $$FALSE
XuiGetResponse (@"XuiFile", @"SelectFile", "", "",
@v0, @v1, @kid, @filename$)
IF (v0 = -1) THEN filename$ = ""
IF filename$ THEN XstGetFileAttributes (@filename$, @attributes)
END FUNCTION
END PROGRAM